@extends('layout.admin')

@section('content')
<div class="container">
	<div class="row">
	
		<div class="span12">
			<ul class="breadcrumb">
				<li><a href="{{ URL::to('admin') }}">首页</a> <span class="divider">/</span></li>
				<li><a href="{{ URL::to('admin/comment') }}">评论管理</a> <span class="divider">/</span></li>
				<li class="active">评论列表</li>
			</ul>
            
<!-- will be used to show any messages -->
@if (Session::has('message'))
	<div class="alert alert-info">
	<button type="button" class="close" data-dismiss="alert">×</button>
	{{ Session::get('message') }}
	</div>
@endif
            
            <table class="table">
              <thead>
                <tr>
                  <th>ID</th>
                  <th>评论内容</th>
                  <th>邮箱</th>
                  <th>状态</th>
                  <th>评论时间</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
              
              @foreach($comments as $comment)
                <tr>
                  <td>{{$comment->id}}</td>
                  <td class="span7">{{$comment->comment}}</td>
                  <td>{{$comment->email}}</td>
                  <td>
                  @if ($comment->status == 2)
                  <button type="button" class="btn btn-danger">未通过</button>
                  @elseif($comment->status == 1)
                  <button type="button" class="btn btn-success">通过</button>
                  @endif
                  </td>
                  <td>{{$comment->created_at}}</td>
                  <td>
{{ Form::open(array('url' => 'admin/comment/' . $comment->id, 'class' => 'pull-right')) }}
	{{ Form::hidden('_method', 'DELETE') }}
	{{ Form::submit('删除', ['class' => 'btn btn-warning', 'onclick' => 'return confirm("确定删除么?")'] ) }}
{{ Form::close() }}
                  
<a class="btn btn-small btn-success" href="{{ URL::to('admin/comment/' . $comment->id) }}">查看</a>

@if ($comment->status == 2)
{{ Form::open(array('url' => 'admin/comment/' . $comment->id, 'class' => 'pull-right')) }}
	{{ Form::hidden('_method', 'PUT') }}
	{{ Form::hidden('status', 1) }}
	{{ Form::submit('审核通过', ['class' => 'btn btn-small btn-success'] ) }}
{{ Form::close() }}
@elseif($comment->status == 1)
{{ Form::open(array('url' => 'admin/comment/' . $comment->id, 'class' => 'pull-right')) }}
	{{ Form::hidden('_method', 'PUT') }}
	{{ Form::hidden('status', 2) }}
	{{ Form::submit('审核拒绝', ['class' => 'btn btn-danger'] ) }}
{{ Form::close() }}

<!-- <a class="btn btn-small btn-success" href="{{ URL::to('admin/comment/' . $comment->id) }}">审核拒绝</a> -->
@endif


              </td>
                </tr>
               @endforeach
                
                <tr>
                  <td colspan="100">{{$comments->links()}}</td>
                </tr>
              </tbody>
            </table>
            
		</div>

	</div>
</div>
@stop

